import {
  createRouter,
  createWebHistory
} from 'vue-router'
// createRouter  创建路由实例   配置history 模式
// 1. history模式:createWebHistory   地址栏不带#
// 2. hash模式：createWebHashHistory   地址栏带#

const router = createRouter({
  history: createWebHistory(
    import.meta.env.BASE_URL),
  routes: [{
      path: '/login',
      component: () => import('@/views/login/LoginView.vue')
    },
    {
      path: '/upload',
      component: () => import('@/components/VideoUpload.vue')
    },
    {
      path: '/videoPay',
      component: () => import('@/components/VideoPlay.vue')
    },
    {
      path: '/videoPayAll',
      component: () => import('@/components/VideoPlayAll.vue')
    },
    {
      path: '/',
      component: () => import('@/views/layout/LayoutView.vue'),
      redirect: '/console',
      children: [{
          path: '/console',
          component: () => import('@/views/console/ConsoleView.vue')
        },
        {
          path: '/article/diet',
          component: () => import('@/views/article/DietView.vue')
        }, {
          path: '/article/medical',
          component: () => import('@/views/article/MedicalView.vue')
        }, {
          path: '/article/news',
          component: () => import('@/views/article/NewsView.vue')
        },
        {
          path: '/community',
          component: () => import('@/views/community/CommunityView.vue')
        },
        {
          path: '/exercise',
          component: () => import('@/views/exercise/ExerciseView.vue')
        },
        {
          path: '/information',
          component: () => import('@/views/personal/InformationView.vue')
        },
        {
          path: '/study',
          component: () => import('@/views/study/StudyView.vue')
        },
        {
          path: '/user',
          component: () => import('@/views/user/UserView.vue')
        },
      ]
    },
  ],
})

export default router
